package com.zzg.config;

import com.zzg.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *配置类用于测试
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    /**
     * 配置拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //addPathPatterns拦截的路径 /** 一切路径
        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**");
    }
}
